<?php
class AskAction extends BaseAction{
		public function _initialize(){
    parent::_initialize();
		!isset($_REQUEST['status']) && $_REQUEST['status'] = "0";
		switch(ACTION_NAME){
			case "myAsk":
				$tab = array(
								L('action_0001')	=>array(
												"status" =>0,
												"class"  =>$this->getTabClass("0")
									 		 ),
								L('action_0002')	=>array(
												"status" =>1,
												"class"  =>$this->getTabClass("1")
								),
								 L('action_0003') =>array(
												"status" =>"continue",
												"class"  =>$this->getTabClass("continue")
								 ),
							);
				break;
			case "myAnswer":
				$tab = array(
								L('action_0004')	=>array(
												"status" =>0,
												"class"  =>$this->getTabClass("0")
									 		 ),
								L('action_0005')	=>array(
												"status" =>1,
												"class"  =>$this->getTabClass("1")
								),
							);
				break;
			case "myHelp":
				$tab = array(
								L('action_0006')	=>array(
												"status" =>0,
												"class"  =>$this->getTabClass("0")
									 		 ),
								L('action_0007')	=>array(
									 		 	"status" =>1,
												"class"  =>$this->getTabClass("1")
								),
							);
				break;
		}
		$this->assign('askTab',$tab);
		$sopt['title'] = getUserName($this->uid).L('action_0008');
		$this->setTitle($sopt);			
	}


	public function myAsk($uid=null){
		$map['uid'] = isset($_GET['uid'])?$_GET['uid']:$this->mid;
		$askData = D('AskInfo','ask')->getAskList($map,40,true);
		$this->assign($askData);	
		$this->display('ask');
	}

	public function myAnswer($uid=null){
		$uid   = isset($_GET['uid'])?$_GET['uid']:$this->mid;
		$askData = D('AskHasAnswer','ask')->getUserAnswer($uid,$_REQUEST['status']);
		$this->assign($askData);
		$this->display('ask');
	}

	public function myHelp($uid=null){
		$status = isset($_GET['status'])?$_GET['status']:0;
		$helpData = D('Help','ask')->getUserHelpAsk(isset($_GET['uid'])?$_GET['uid']:$this->mid,40,$status);
		$this->assign($helpData);
		$this->display('ask');

	}
	private function getTabClass($status){
		return $_REQUEST['status'] === $status?"on":"off";
	}
}